/*
 * @Author: CNN 969682281@qq.com
 * @Date: 2023-08-10 10:03:23
 * @LastEditors: 贺楠 1071780426@qq.com
 * @LastEditTime: 2024-11-15 10:02:54
 * @FilePath: \ZjGx_s\mainPro\src\router\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// 1.引入创建路由需要的组件
import {
    createRouter,
    createWebHistory,
} from "vue-router";

import qiankCon from '../qiankun/index.vue'

// 2.配置系统所有路由页面
const routes: any = [
    {
        path: "/",
        component: () => import("../layout/index.vue"),
        children: [
            {
                path: "/",
                meta: {
                    title: "首页"
                },
                component: qiankCon,
            },
            {
                path: "/material/:catchAll(.*)",
                name: "material",
                component: qiankCon,
            },
            {
                path: "/qualities/deviceManagement/:catchAll(.*)",
                name: "szsys",
                component: qiankCon,
            },
            {
                path: "/qualities/experimentalManagement/:catchAll(.*)",
                name: "experimentalManagement",
                component: qiankCon,
            },
        ]
    }
];
// 3.创建路由实例
const router = createRouter({
    history: createWebHistory(), //使用history模式，hash模式使用 createWebHashHistory() 方法
    routes,
});

router.beforeEach((to, from, next) => {
    if (!history.state.current) {
        history.state.current = from.fullPath;
    }
    next();
});
// 4.声明,为路由提供外部引用的入口
export default router;
